package com.njtoyo.taxi.admin.rest.wrapper.platform.adminUser;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.mapper.secondary.entity.AdminUser;
import com.njtoyo.taxi.admin.mapper.secondary.enums.adminuser.AccountType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

@Data
@ApiModel("管理员筛选对象")
public class AdminUserListWrapper extends Page<AdminUser> {

    public AdminUserListWrapper(Long current, Long size) {
        super(Objects.isNull(current) ? 1 : current, Objects.isNull(size) ? 15 : size);
    }

    @ApiModelProperty("姓名，账号，手机或邮箱")
    private String account;

    @ApiModelProperty("上级id")
    private Long superiorId;

    @ApiModelProperty("角色id")
    private Long roleId;

    @ApiModelProperty("账号类型")
    private AccountType accountType;

    public Integer getAccountType() {
        if (Objects.isNull(accountType)) {
            return null;
        }
        return accountType.getCode();
    }
}
